<template>
	<view class="all" :style="{'height':widHeight + 'px'}">
		<view class="head">
			<text>取消</text>
			<text style="color: red;" @click="save">保存</text>
		</view>
		<!-- 	<textarea style="height: 200px;background-color: white;width: 100%;" @blur="blur" v-model="value2"
		placeholder="介绍自己,让大家了解和关注你~" auto-focus /> -->
		<u--textarea v-model="value2" @blur="blur" :height="200" placeholder="介绍自己,让大家了解和关注你~" count></u--textarea>
	</view>
</template>

<script>
	import {
		mapMutations,
		mapState
	} from "vuex"
	export default {
		data() {
			return {
				widHeight: 0,
				value2: '',
				value: ''
			};
		},
		computed: {
			...mapState("setting", ["sign"]),
		},
		onLoad() {
			uni.$setNavigationBarColor()
			this.value2 = this.sign
			const windowInfo = uni.getWindowInfo()
			this.widHeight = windowInfo.windowHeight //可使用窗口宽度
		},
		methods: {
			...mapMutations("setting", ["updataSign"]),
			blur() {
				this.value = this.value2

			},
			save() {
				if (this.value.trim().length == 0) {
					return uni.$showToast("内容不能为空", "error")
				}
				uni.showLoading({
					title: '更改中……'
				})
				setTimeout(() => {
					uni.hideLoading()
					this.updataSign(this.value)
					uni.redirectTo({
						url:'/subStting/personal-information/personal-information'
					})
				}, 1500)

			}
		},
	}
</script>

<style lang="scss">
	.all {
		background-color: #eeeeee;

		.head {
			display: flex;
			justify-content: space-between;
			padding: 10px 15px;

		}
	}
</style>